Why It's Nice to be Quoted: Quasiquoting for Prolog
نویسندگان
چکیده
Prolog’s support for dynamic programming, meta programming and text processing using context free grammars make the language highly suitable for defining domain specific languages (DSL) as well as analysing, refactoring or generating expression states in other (programming) languages. Well known DSLs are the DCG (Definite Clause Grammar) notation and constraint languages such as CHR. These extensions use Prolog operator declarations and the {. . .} notation to realise a good syntax. When external languages, such as HTML, SQL or JavaScript enter the picture, operators no longer satisfy for embedding snippets of these languages into a Prolog source file. In addition, Prolog has poor support for quoting long text fragments. Haskell introduced quasi quotations to resolve this problem. In this paper we ‘ported’ the Haskell mechanism for quasi quoting to Prolog. We show that this can be done cleanly and that quasi quoting can solve the above mentioned problems.
منابع مشابه
Programming Towards a Roberto Barbuti ” , logical semantics for pure Prolog ’
The coincidence of the declarative and procedural interpretations of logic programs does not apply to Prolog programs, due to the depth-first left-to-right evaluation strategy of Prolog interpreters. We propose a semantics for Prolog programs based on a four-valued logic. The semantics is based on a new concept of completion analogous to Clark’s and it enjoys the nice properties of the declarat...
متن کاملA Multiple-Valued Logical Semantics for Prolog
Abs t rac t . The coincidence of the declarative and procedural interpretations of logic programs does not apply to Prolog programs, due to the depth-first left-to-right evaluation strategy of Prolog interpreters. We propose a new semantics for Prolog programs based on a new fourvalued logic. The semantics is based on a new concept of completion analogous to Clark's and it enjoys the nice prope...
متن کاملTowards a Logical Semantics for Pure Prolog
The coincidence of the declarative and procedural interpretations of logic programs does not apply to Prolog programs, due to the depth-rst left-to-right evaluation strategy of Prolog interpreters. We propose a semantics for Prolog programs based on a four-valued logic. The semantics is based on a new concept of completion analogous to Clark's and it enjoys the nice properties of the declarativ...
متن کاملEvent Handling in Prolog
This paper puts forward the argument for a general and flexible event handling mechanism in Prolog. This will make it more user-friendly, more powerful and more versatile for use in various real-life application domains. We present a scheme of handling synchronous and asynchronous events in Prolog, justify why such a scheme should be incorporated in Prolog, present its advantages and describe h...
متن کاملSICStus MT - Multithreaded Execution Environment for SICStus Prolog
We have designed and implemented a multithreaded execution environment for SICStus Prolog. The threads are dynamically managed using a small and compact set of Prolog primitives and they are implemented completely on user-level, requiring almost no support from the underlying operating system. The development of intelligent software agents has been one of the reasons why explicit concurrency ha...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/1308.3941 شماره
صفحات -
تاریخ انتشار 2013